package com.design.cfr;

import java.util.function.Function;

/**
 * Chain responsibility element 责任链元素，包含 设置获取next元素，及执行方法。
 * T --> apply(T t)的参数
 * AR --> apply(T t)的返回值
 * E --> 下一个元素的类型
 * @description:
 * @author: cyj
 * @date 2022 -08-12 15:34:48
 */
public interface ChainResponsibilityElement<T, AR, E> extends Function<T, AR> {

    /**
     * Gets next 获取下一个元素
     *
     * @return the next
     */
    E getNext();

    /**
     * Sets next 设置下一个元素
     *
     * @param chainResponsibilityElement chain responsibility element
     */
    void setNext(E chainResponsibilityElement);
}
